/// <reference path="jquery.js" />
$(function () {

    //视频播放器调用
    if ($(".videobox").is(":visible")) {
        aboutvideo();
	
    }
    //
//	var videoW = $(".videobox").width();
//    $(window).resize(function(){
//	     var videoW = $(".videobox").width();
//		 aboutvideo();
//	})
	   

})


function aboutvideo() {

    if ($("html").hasClass("lt9")) {
        videoBox($(".videobox").width(), $(".videobox").width()*0.4965, $(".videobox video").attr("src"), $(".videobox video").attr("poster"));
    }
    else {
        $(".videobox video").width($(".videobox").width()).height($(".videobox").width()*0.4965)
        var player = new MediaElementPlayer('#player1', {
            defaultVideoWidth: $(".videobox").width(),
            defaultVideoHeight: $(".videobox").width()*0.4965,
            enableAutosize: false,
            success: function (player, node) {
                $('#' + node.id + '-mode').html('mode: ' + player.pluginType);
            }
        });
        //player.play();
    }

}

function videoBox(width, height, url, img) {
    var s1 = new SWFObject("flvplayer.swf", "single", width, height, "7");
    s1.addParam("allowfullscreen", "true");
    s1.addParam("wmode", "transparent");
    s1.addVariable("file", url);
    s1.addVariable("image", img);
    s1.addVariable("autostart", "false");
    s1.addVariable("width", width);
    s1.addVariable("backcolor", 0x000000);
    s1.addVariable("frontcolor", 0xFFFFFF);
    s1.addVariable("lightcolor", 0x000000);
    s1.addVariable("height", height);
    s1.write("indexplayer");
}

